package com.hr.approval.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author hr
 * @since 2024-05-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("approval_data")
@ApiModel(value="ApprovalData对象", description="")
@NoArgsConstructor
@AllArgsConstructor
public class ApprovalData extends Model {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "发起人id")
    @TableField("reporter_id")
    private Integer reporterId;

    @ApiModelProperty(value = "发起人name")
    @TableField("reporter_name")
    private String reporterName;

    @ApiModelProperty(value = "发起人部门")
    @TableField("reporter_dept_id")
    private Integer reporterDeptId;

    @ApiModelProperty(value = "起始时间")
    @TableField("start_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime startTime;

    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @ApiModelProperty(value = "终止时间")
    @TableField("end_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "申请类别 ")
    @TableField("type")
    private Integer type;

    @ApiModelProperty(value = "请假时长 ")
    @TableField("approval_time")
    private Float approvalTime;

    @ApiModelProperty(value = "领导审批人 ")
    @TableField("approval_leader_id")
    private Integer approvalLeaderId;

    @ApiModelProperty(value = "状态（0等待部门审批 1等待人事审批 2 等待领导审批 3审批通过）")
    @TableField("state")
    private Integer state;

    @ApiModelProperty(value = "部门审批人 ")
    @TableField("approval_bm_id")
    private Integer approvalBmId;

    @ApiModelProperty(value = "人事审批人 ")
    @TableField("approval_hr_id")
    private Integer approvalHrId;
    @TableField("create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
